package com.hbpu.encap.stringbuffer;

import java.util.Scanner;

public class StringBufferExercise {
    public static void main(String[] args) {
        System.out.print("请输入商品名称：");
        String name = new Scanner(System.in).nextLine();
        System.out.print("请输入商品价格：");
        String price = new Scanner(System.in).nextLine();
        StringBuffer stringBuffer = new StringBuffer(price);
        int index = stringBuffer.indexOf(".");
        for (int i = index - 3; i > 0; i -= 3) {
            stringBuffer.insert(i, ',');
        }
        System.out.println(stringBuffer);
    }
}
